module namespace security="http://sendmeafilter.com/common/security";
import module namespace json="http://sendmeafilter.com/common/json" at "json.xqy";
import module namespace kart="http://sendmeafilter.com/common/kart" at "kart.xqy";
import module namespace ck = "http://sendmeafilter.com/modules/cookies" at "cookies.xqy";
import module namespace tx="http://txhelper.org/tx" at "tx.xqy";

declare boundary-space preserve;
declare option xdmp:mapping "false";

declare variable $testusers :=
<users>
	<user username="steinerdj" passhash="adkjfhalkjsdf" privs="dev,admin,affiliate"/>
</users>
;

declare variable $cookieName := 'smafs';
declare variable $cookieDomain := '.sendmeafilter.com';
declare variable $cookieExpires := fn:current-dateTime() + xs:dayTimeDuration('PT60M');

declare function security:allowed($priv as xs:string) {
xdmp:role($priv) = xdmp:get-current-roles()	
(:	let $id := ck:get-cookie($cookieName):)
};

declare function security:user() {
	xdmp:get-current-user()
};

declare function security:userName() {
	xdmp:get-current-user()
};

